{template 'common/header'}
<title>赠送金币</title>
<script src="../addons/ewei_shop/static/js/dist/ajaxfileupload.js" type="text/javascript"></script>
<style type="text/css">
    body {margin:0px; background:#efefef; font-family:'微软雅黑'; -moz-appearance:none;}
    a {text-decoration:none;}
    .myshop_addnav {height:44px; width:94%; padding:0 3%; border-bottom:1px solid #f0f0f0; border-top:1px solid #f0f0f0; margin-top:14px; line-height:42px; color:#666; background:#fff;}
    .myshop_addnav {height:40px; width:94%; padding:0 3%; border-bottom:1px solid #f0f0f0; border-top:1px solid #f0f0f0; margin-top:14px; line-height:40px; color:#666; }
.myshop_main {height:auto;width:94%; padding:0px 3%; border-bottom:1px solid #f0f0f0; border-top:1px solid #f0f0f0; margin-top:14px; background:#fff;}
.myshop_main .line {height:44px; width:100%; border-bottom:1px solid #f0f0f0; line-height:44px;}

.myshop_main .line .label { float:left;width:70px;}
.myshop_main .line .info { float:right; width:100%; margin-left:-75px;text-align: right;overflow:hidden;height:44px;}
.myshop_main .line .info .inner { color:#666;margin-left:75px;}

.myshop_main .line1 {height:80px; width:100%; border-bottom:1px solid #f0f0f0; line-height:80px;}
.myshop_main .line1 .label { float:left;width:70px;}
.myshop_main .line1 .info { float:right; width:100%; margin-left:-75px;;overflow:hidden;height:80px;}
.myshop_main .line1 .info .inner { color:#666;margin-left:75px;padding-top:10px;}
.myshop_main .line1 .info .inner .plus { float:left;width:60px;height:60px;border:1px solid #efefef; color:#efefef;; font-size:45px;line-height:55px;text-align:center;}
.myshop_main .line1 .info .inner .plus1 { float:left;width:90%;height:60px;border:1px solid #efefef; color:#efefef;; font-size:45px;line-height:55px;text-align:center;}

.myshop_main .line1 .info .inner .preview0 { position:absolute; width:60px;height:60px;z-index:2}
.myshop_main .line1 .info .inner .preview1 { position:absolute; width:90%;height:60px;z-index:2}

.myshop_main .line1 .info .inner .preview0 img,.myshop_main .line1 .info .inner .preview1 img { width:100%;height:100%;}

.myshop_main .line input {float:left; height:44px; width:100%; padding:0px; margin:0px; border:0px; outline:none; font-size:16px; color:#666;padding-left:5px;}
.myshop_main .line select  {float:left; border:none;height:25px;width:100%;color:#666;font-size:16px;margin-top:10px;}
.myshop_sub1 {height:44px; width:94%; margin:14px 3% 0px; background:#ff4f4f; border-radius:4px; text-align:center; font-size:16px; line-height:44px; color:#fff;}
.myshop_sub2 {height:44px; width:94%; margin:14px 3% 0px; background:#ddd; border-radius:4px; text-align:center; font-size:16px; line-height:44px; color:#666; border:1px solid #d4d4d4;}

.myshop_main .line2 {width:100%;  line-height:25px; color:#666;overflow:hidden; font-size:13px;word-break: break-all;}

textarea {height:60px;line-height:22px; width:100%;padding:5px;font-size:13px; background:#fff; padding-left:2%; border:1px solid #e9e9e9; margin:14px 0px 0; -webkit-appearance: none;} 
.myshop_menu {height:44px; background:#fff;}
.myshop_menu .nav {height:44px; width:50%; border-bottom:1px solid #f1f1f1;background:#fff; border-left:1px solid #f1f1f1; float:left; line-height:44px; font-size:14px; color:#666; text-align:center;}
.myshop_menu .navon {height:42px; color:#ff771b; border-bottom:2px solid #ff771b;}
.info2 {height:150px;padding:10px; padding-bottom:80px; border-bottom:1px solid #eee; border-top:1px solid #eee;}
.info2 .con {height:auto; padding:10px 0px;}
.info2 .con .line2 {height:auto; overflow:hidden; margin-bottom:5px;}
.info2 .con .line2 .t1 {height:auto; width:55px; float:left; font-size:14px; color:#666; line-height:20px;}
.info2 .con .line2 .t2 {padding-left:0px; background:#f90;}
.info2 .con .line2 .t2 .t3 {height:auto; float:left; font-size:14px; color:#999;} 
</style>
<div id='container'></div>
   <div class="page_topbar">
    <a href="javascript:;" class="back" onclick="location.href='{php echo $this->createPluginMobileUrl('commission/myshop/activity_list')}'"><i class="fa fa-angle-left"></i></a>
    <div class="title">编辑金币</div>
</div>
    <div class="myshop_menu">
            <div class="nav navon" style="border-left:0px;width:49%;" onclick="location.href='{php echo $this->createPluginMobileUrl('commission/myshop',array('op'=>'gold'))}'">编辑金币</div>
            <div class="nav"  onclick="location.href='{php echo $this->createPluginMobileUrl('commission/myshop',array('op'=>'gold_log'))}'">赠送记录</div>
    </div>
    <div class="myshop_main" >
        <div class="line"><div class="label">金&nbsp;&nbsp;&nbsp;额：</div><div class="info"><div class="inner"><input type="text" id="money" value="" placeholder="金币余额{$gold['gold']}"/></div></div></div>
    </div>
    <div class="myshop_sub1" id='disabled' style="background:#888888;">确认</div>
    <div class="myshop_sub1" id='myshop_submit' style="display:none;">确认</div>
    <div class="myshop_sub1" id='shop_gold'>购买金币券</div>
    	<div class="info2">
        <div class="con">
          <div class="line2">
          	<div class="t2">
            	<div class="t3">1.确认赠送金币的数目。</div>
          	</div>
          </div>
          <div class="line2">
          	<div class="t2">
            	<div class="t3">2.点击赠送记录选择金币将二维码分享给好友即可。</div>
          	</div>
          </div>
  	    </div>
	</div>
<script language="javascript">
    $('#shop_gold').click(function(){
        location.href='http://wx.lanxuevip.com/app/index.php?i=5&c=entry&do=shop&m=ewei_shop&p=detail&id=316&my=';
    });
    
    require(['tpl', 'core'], function(tpl, core) {
                            function checkForm(){
                                var inputs=$(":input");
                                for(var i=0;i<inputs.length;i++)   {  
                                      if(inputs[i].value==""||inputs[i].value==null){
                                      return false;
                                      }  
                                }
                            }
                            function checkdate(){
                                var check=checkForm();
                                var money=$('#money').val();
                                if(check != false  && money > 0 && !isNaN(money)){
                                $("#disabled").hide();
                                $("#myshop_submit").show();
                                }else{
                                $("#disabled").show();
                                $("#myshop_submit").hide();
                                }
                            }
                            $('#money').unbind('keyup').keyup(function(){
                            checkdate();
                            });
                            $('#myshop_submit').click(function(){
                               if($(this).attr('saving')=='1'){
                                   return;
                               }
                                $(this).html('正在处理...').attr('saving',1);
                                if($('#money').isEmpty()){
                                    core.tip.show('请输入金额!');
                                    return;
                                }
                                var money=$('#money').val();
                                if(money < 0){
                                    core.tip.show('金额请输入大于0的数字!');
                                    return;
                                }
                                if(isNaN(money)){
                                    core.tip.show('金额，请输入数字类型!');
                                    return;  
                                }
                                var data = {
                                        money: $('#money').val()
                                }
                                core.pjson('commission/myshop',{
                                    op:'gold',
                                    data:data
                                 },function(postjson){
                                     if(postjson.status==1){
                                        location.href ='http://wx.lanxuevip.com/app/index.php?i=5&c=entry&do=gold&p=receive&m=ewei_shop&gold_id='+postjson.result.gold_id;
                                     }
                                     else{
                                         $(this).html('确认').removeAttr('saving');
                                         if(postjson.status==0){
                                          core.tip.show('亲，你的金币不够！！');    
                                         }else{
                                          core.tip.show('操作失败');    
                                         }
                                     }
                                },true,true);
                           }); 
    })
</script>
{template 'common/footer'}